Skip to main content

13.Write Python programs to create functions and use functions in the program.

# function definition
def msg():
print("Hello Peter")

def sum(a, b):
print(a + b)

# function calling
msg()
sum(5, 2)
Reference
  • A function can be defined as the organized block of reusable code, which can be called whenever required.
  • Python provides the def keyword to define the function.

https://www.javatpoint.com/python-functions